package model

import (
	"gorm.io/gorm"
	"time"
)

type Gift struct {
	Id        uint           `gorm:"column:id;type:bigint(20) UNSIGNED;primaryKey;not null;" json:"id"`
	Name      string         `gorm:"column:name;type:varchar(255);comment:礼物名称;not null;" json:"name"`                   // 礼物名称
	Money     uint           `gorm:"column:money;type:bigint(3) UNSIGNED;comment:礼物价格;not null;default:0;" json:"money"` // 礼物价格
	FileUrl   string         `gorm:"column:file_url;type:varchar(255);comment:图片地址;not null;" json:"file_url"`           // 图片地址
	CreatedAt time.Time      `gorm:"column:created_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"created_at"`
	UpdatedAt time.Time      `gorm:"column:updated_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3);default:NULL;" json:"deleted_at"`
}

func (g *Gift) TableName() string {
	return "gift"
}

type UserGift struct {
	Id        uint           `gorm:"column:id;type:bigint(20) UNSIGNED;primaryKey;not null;" json:"id"`
	UserId    uint           `gorm:"column:user_id;type:bigint(20) UNSIGNED;comment:用户id;not null;default:0;" json:"user_id"`      // 用户id
	GiftId    uint           `gorm:"column:gift_id;type:bigint(20) UNSIGNED;comment:礼物lid;not null;default:0;" json:"gift_id"`     // 礼物lid
	Status    uint           `gorm:"column:status;type:int(10) UNSIGNED;comment:礼物状态 1：存在 2:送出;not null;default:1;" json:"status"` // 礼物状态 1：存在 2:送出
	CreatedAt time.Time      `gorm:"column:created_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"created_at"`
	UpdatedAt time.Time      `gorm:"column:updated_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3);default:NULL;" json:"deleted_at"`
}

func (u *UserGift) TableName() string {
	return "user_gift"
}

type ReveiveGift struct {
	Id            uint      `gorm:"column:id;type:bigint(20) UNSIGNED;primaryKey;not null;" json:"id"`
	SendUserId    uint      `gorm:"column:send_user_id;type:bigint(20) UNSIGNED;comment:送礼物人id;not null;default:0;" json:"send_user_id"`       // 送礼物人id
	ReceiveUserId uint      `gorm:"column:receive_user_id;type:bigint(20) UNSIGNED;comment:收礼物人id;not null;default:0;" json:"receive_user_id"` // 收礼物人id
	GiftId        uint      `gorm:"column:gift_id;type:bigint(20) UNSIGNED;comment:礼物id;not null;default:0;" json:"gift_id"`                   // 礼物id
	CreatedAt     time.Time `gorm:"column:created_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"created_at"`
}

func (r *ReveiveGift) TableName() string {
	return "reveive_gift"
}
